package com.freeman.cement.myenum;

import lombok.Getter;

/**
 * 报警/事件等级
 */
@Getter
public enum EventLvl {
    HIGH("高等级", 3),
    MIDDLE("中等级", 2),
    LOW("低等级", 1);

    // 成员变量
    private String name;
    private int index;

    // 构造方法
    private EventLvl(String name, int index) {
        this.name = name;
        this.index = index;
    }

    // 普通方法
    public static String getName(int index) {
        for (EventLvl c : EventLvl.values()) {
            if (c.getIndex() == index) {
                return c.name;
            }
        }
        return null;
    }

}
